
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="../../style/css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../style/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var  id =(location.search).split("=")[1];
            //查询所有信息
            $.get("../../role/findrole",{id:id},function (res){
                console.log(res);
                $("input[name='name']").val(res.data.name);
                $("input[name='describ']").val(res.data.describ);
            },"json");
        })

        //修改保存成功
        function subform() {
            var  id =(location.search).split("=")[1];
            var name =$("#name").val();
            var describ =$("#describ").val();
            $.post("../../role/update",{name:name,describ:describ,id:id},function (res) {
                if (res.code==200){
                    alert("修改成功!!");
                    location.assign("list.html");
                }else {
                    alert("服器忙碌");
                }
            });
        }
        </script>
</head>
<body>
<form id="formId">
    <div class="formbody">
        <div class="formtitle"><span>基本信息</span></div>
        <ul class="forminfo">
            <li>
                <label>角色名称</label>
                <input name="name" id="name" type="text" class="dfinput" />
            </li>
            <li>
                <label>描述</label>
                <input name="describ"  id="describ" type="text" class="dfinput" />
            </li>
         <!--   <li>
                <label>操作人</label>
                <input name="account"  type="text" class="dfinput" />
            </li>
            <li>
                <label>操作时间</label>
                <input name="operate_time"  type="text" class="dfinput" />
            </li>-->
            <li>
                <input name="" type="button" class="btn" value="确认修改" onclick="subform()"/>
            </li>
        </ul>
    </div>
</form>

</body>
</html>